import java.util.ArrayList;
import java.util.List;

public class Student extends Person {

    List<Course> courses = new ArrayList<>();

    public Student(String id, String name, String gender) {
        super(id, name, gender);
    }

    public void chooseCourse(Course c) {
        courses.add(c);
        System.out.println(name + "选了课程：" + c.name);
    }

    public void dropCourse(Course c) {
        if (courses.remove(c)) {
            System.out.println(name + "退了课程：" + c.name);
        } else {
            System.out.println(name + "没选这门课，无法退课");
        }
    }

    public void printCourses() {
        System.out.println(name + "的课表：");
        for (Course c : courses) {
            System.out.println("课程：" + c.name + "，地点：" + c.location + "，时间：" + c.time + "，老师：" + c.teacher.name);
        }
    }
}